package cn.edu.javaweb.userServlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import cn.edu.javaweb.utils.DBUtil;


@WebServlet("/PersonalDelServlet")
public class PersonalDelServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
	DBUtil db;
    
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		this.doPost(request, response);
	}

	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		db=new DBUtil(); //建创对象 搭桥配置初始化
		HttpSession session = request.getSession(true);
		String id = (String)session.getAttribute("id");
		String realname=request.getParameter("realname");
		String uclass=request.getParameter("uclass");
		String sex=request.getParameter("sex");
		String sql="update user set roster='0' where id='"+id+"'";
		System.out.println(sql);
		int result=db.update(sql);
		PrintWriter out=response.getWriter();
		response.sendRedirect("/Volunteer/volunteer/Login&Register.jsp");
	}

}
